package cn.ethan.demo.design;

/**
 * 线程安全-单例模式 懒汉式
 *
 * @author 张俊辉
 */
public class Singleton_02 {

    private static Singleton_02 instance;

    private Singleton_02() {}

    public static synchronized Singleton_02 getInstance() {
        if (instance != null) {
            return instance;
        }
        instance = new Singleton_02();
        return instance;
    }
}
